home *** CD-ROM | disk | FTP | other *** search
/ PC Format (UK) 188 / 01-04 PC Format 188 [2006-06] DVD side 1_.iso / Menus / Scenes / HOME.dir / 00008_Script_SubMenuButtonHandler < prev    next >
Text File  |  2006-04-20  |  3KB  |  130 lines

  1. property Sp
  2. property myList
  3. property myTxtSp
  4. property clicked
  5. global mKey
  6. global SubStartChannel
  7. global cList
  8.  
  9.  
  10.  
  11. on init me, aListEntry
  12.   Sp = sprite(me.spritenum)
  13.   myTxtSp = sprite(sp.spritenum + 1)
  14.   myList = aListEntry
  15.   clicked = false
  16. end
  17.  
  18.  
  19. on mouseEnter me
  20.   cursor 280
  21.   myTxtSp.member.color = rgb(193,24,29)
  22.   Sp.member = member("button_Over")
  23. end
  24.  
  25.  
  26. on mouseLeave me
  27.   if clicked = false then
  28.     myTxtSp.member.color = rgb(0,0,0)
  29.     sp.member = member("button")
  30.     cursor -1
  31.   end if 
  32. end
  33.  
  34.  
  35. on Unclick_SubMenu me, aSpritenum
  36.   clicked = false
  37.   if aSpritenum <> Sp.spritenum then
  38.     myTxtSp.member.color = rgb(0,0,0)
  39.     sp.member = member("button")
  40.     cursor -1
  41.   end if
  42. end
  43.  
  44.  
  45.  
  46. on mouseUp me
  47.   if clicked = false then
  48.     
  49.     
  50.     sendAllsprites(#Unclick_SubMenu, Sp.spritenum)
  51.     clicked = true
  52.     
  53.     pLocV = Sp.locV
  54.     pLocH = Sp.right
  55.     
  56.     pPoint = point(Sp.right, 110)
  57.     
  58.     b = member("item_button")
  59.     
  60.     b.regpoint = point(0,0)
  61.     
  62.     member("Item_Button_Over").regpoint = point(0,0)
  63.     
  64.     bh = b.height
  65.     bw = b.width
  66.     
  67.     chn = cList.itemMenu[1]
  68.     
  69.     clearScriptedSprites(cList.itemmenu)
  70.     
  71.     repeat with d = 1 to castlib("Item_Menu_Text").member.count
  72.       member(d, 5).erase()
  73.     end repeat
  74.     
  75.     repeat with i = 1 to myList.pItem.count
  76.       
  77.       if i = 11 then
  78.         --        
  79.         chn = chn + 1
  80.         channel(chn).makescriptedsprite(member("glass_button_bottom"), pPoint)
  81.         chn = chn +1
  82.         pPoint.loch = pPoint.loch + bw
  83.         pPoint.locV = 110
  84.       end if
  85.       
  86.       
  87.       
  88.       channel(chn).makescriptedsprite(b, pPoint)
  89.       sc = script("Item_Button_Handler").new()
  90.       sprite(chn).scriptinstanceList.add(sc)
  91.       sendsprite(chn, #init, myList.pItem[i])
  92.       chn = chn + 1
  93.       nt = new(#text, castlib 5)
  94.       nt.text = myList.pItem[i].pTitle
  95.       nt.antialias = true
  96.       nt.antialiasthreshold = 0
  97.       nt.color = rgb(0,0,0)
  98.       nt.width = bw
  99.       nt.fontstyle = [#bold]
  100.       nt.fontsize = 12
  101.       txtLoc = pPoint + point(10,8)
  102.       channel(chn).makescriptedsprite(nt, txtLoc)
  103.       sprite(chn).ink = 36
  104.       chn = chn + 1
  105.       pPoint.locV = pPoint.locV + bh
  106.     end repeat
  107.     
  108.     chn = chn + 1
  109.     channel(chn).makescriptedsprite(member("glass_button_bottom"), pPoint)
  110.     chn = chn +1
  111.     pPoint.loch = pPoint.loch + bw
  112.     pPoint.locV = 110
  113.     
  114.     
  115.   else
  116.     clicked = false
  117.     clearScriptedSprites(cList.itemmenu)
  118.     myTxtSp.member.color = rgb(0,0,0)
  119.     sp.member = member("button")
  120.     cursor -1
  121.     
  122.   end if
  123.   
  124.   
  125. end
  126.  
  127.  
  128.  
  129.  
  130.